import 'package:flutter/material.dart';
import 'package:industry_net/base/component/list/section.dart';
import 'package:industry_net/base/component/list/table_man.dart';

SliverList sliverTableView(
    {required List<SectionModel> data, Widget? header, Widget? footer}) {
  TableMan man = TableMan();
  man.getCount(data, hasHeader: header != null, hasFooter: footer != null);
  Widget getItem(BuildContext context, int index) {
    man.initItems(context, data, header, footer);
    return man.items[index];
  }

  return SliverList(
    delegate: SliverChildBuilderDelegate((context, index) {
      return getItem(context, index);
    }, childCount: man.count),
  );
}
